/*
 * ExportForm.java
 *
 * Created on June 11, 2006, 5:37 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */
import java.sql.*;
import java.io.*;
import javax.swing.*;
/**
 *
 * @author ayakout
 */
public class ExportForm {
    private RandomAccessFile file;
    /** 
     * Creates a new instance of ExportForm 
     * which creates a export configuration file and writes
     * 1) Username
     * 2) Password
     * 3) Hostname
     * 4) Database
     * 5) Form name
     */
    public ExportForm() {
        try {
            String curDir = System.getProperty("user.dir");    
            ObjectInputStream file = new ObjectInputStream(getClass().getResourceAsStream("export.cfg"));
            //file = new RandomAccessFile(f, "r");            
            MainWindow.dbCon = new DBConnector(file.readUTF(), file.readUTF(), file.readUTF());
            String dbName = file.readUTF();
            MainWindow.dbCon.setDatabase(dbName);
            MainWindow.selectedDatabase = dbName;
            OpenView.openView(file.readUTF());
        } catch(Exception ex){ 
            ex.printStackTrace();
            JOptionPane.showMessageDialog(null, ex.getMessage());
        };        
    }
    
    public static void main(String[] args) {
        new ExportForm();
    }
}
